@extends('layouts.home.layout')
@section('content')
    @include('layouts.home._nav')
    <div class="calc-entry" style="margin-top:20px;">
        <ul class="am-cf">
            <li class="ce-li cel1" style="margin-left:150px;"><a href="/main/mortgage">购房贷款工具</a></li>
            <li class="ce-li cel2"><a href="/main/card">信用卡分期</a></li>
            {{--<li class="ce-li cel3"><a href="/main/evaluate">贷款能力评估</a></li>--}}
            <li class="ce-li cel4 cur"><a href="/apply/cardstepone">信用卡快捷推荐</a></li>
        </ul>
    </div>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".tow").attr('id', '');
            $(".onesss").attr('id', 'navcur');
        });
    </script>

    <div class="financial">
        <div style="display:none;">
            <div class="financial_top">
                <div class="financial_title">
                    <img src="{{asset('home')}}/images/jrlogz_03.jpg"/>
                    <div>
                        <h1>信用卡快捷推荐</h1>
                        <p>轻松办卡快速拿卡</p>
                    </div>
                </div><!--financial_title-->
            </div><!--financial_top-->

            <div class="jrbz"><img src="{{asset('home')}}/images/bz1_03.jpg" width="831" height="39"/></div>
            <form action="{{url('apply/cardstepone')}}" method="post" id="oneForm" name="oneForm">
                <div class="yzbox">
                    <p>您的姓名</p>
                    <input class="yzinput_box" name="name"/>
                </div>
                <div class="yzbox">
                    <p>您的性别</p>
                    <div class="radiobox" style="border:none;">
                        <input type="radio" name="sex" class="xianjin"/>
                        <p>男</p>
                        <input type="radio" name="sex" class="chuxuka"/>
                        <p>女</p>
                    </div>
                </div>
                <div class="yzbox">
                    <p>手机号码</p>
                    <input class="yzinput_box" name="mobile"/>
                </div>
                <div class="yzbox">
                    <p>所在省市</p>
                    <select class="city_select" name="city">
                        <option>选择城市</option>
                    </select>
                    <select class="provinces_select" name="province">
                        <option>选择省份</option>
                        @foreach($provinces as $key=>$val)
                            <option value="{{$val->region_code}}">{{$val->region_name}}</option>
                        @endforeach
                    </select>
                </div>
                <button type="button" class="nextbtn subBtn" style="margin-top:30px;">下一步</button>
            </form>
        </div>
    </div><!--financial-->


    <script>
        var regionurl = "{{url('main/region')}}";
        $('.provinces_select').change(function () {
            var code = $(this).val();
            $.post(regionurl, {code: code}, function (result) {
                $('.city_select').html(result)
            })
        });

        //同意
        $('.isagree').change(function () {
            if ($('.isagree').is(':checked') == true) {
                $('.subBtn').attr('disabled', false)
            } else {
                $('.subBtn').attr('disabled', true)
            }
        })
        $(document).ready(function () {
            var twooptions = {
                success: function (data) {
                    $(".subBtn").attr('disabled', false);
                    layer.msg(data.message);
                    if (data.code == '0000') {
                        window.location.href = "{{url('apply/cardsteptwo')}}" + '?recordid=' + data.recordid;
                    }
                }
            };
            $(".subBtn").click(function () {
                var fm = document.forms['oneForm'];// HTML DOM 通过form 元素的name值获取
                //
                var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                if (!myreg.test(fm.mobile.value)) {
                    layer.msg('请输入有效的手机号码！');
                    return false;
                }
                if (fm.name.value == '') {
                    layer.msg('请填写姓名');
                    return false;
                }
                if (fm.sex.value == '') {
                    layer.msg('请选择性别');
                    return false;
                }
                if (fm.province.value == '') {
                    layer.msg('请选择省份');
                    return false;
                }
                if (fm.city.value == '') {
                    layer.msg('请选择城市');
                    return false;
                }

                $(".subBtn").attr('disabled', true);//禁用按钮
                $("#oneForm").ajaxSubmit(twooptions);
            });
        });


    </script>
@endsection